<#include "app/contract/filters/filter-for-contract-c-and-m-list.ftl">

<table class="my-contract" data-page="${page!1}" data-page="${page!'1'}" data-count="${count!'0'}" data-page-size="${pageSize!'30'}">
	<tr class="title-row">
		<th class="text-center" width="45">序号</th>
		<th class="text-center">合同编号</th>
		<th class="text-center">合同名称</th>
		<th class="text-center">合同金额（元）</th>
		<th class="text-center" width="130">结算上报</th>
		<th class="text-center">结算金额（元） <br> （比率）
		</th>
		<th class="text-center">已收金额（元） <br> （比率）
		</th>
		<th class="text-center">未收金额（元） <br> （比率）
		</th>
		<th class="text-center">付款金额（元） <br> （比率）
		</th>
		<th class="text-center">已付金额（元） <br> （比率）
		</th>
		<th class="text-center">未付金额（元） <br> （比率）
		</th>
		<th class="text-center">利润（元） <br> （比率）
		</th>
	</tr>
	<#if data??> <#list data as c>
	<tr onclick="window.open('${request.contextPath}/contract/view/${c.id}','_blank');" style="cursor: pointer;">
		<td class="text-center">${c_index+1}</td>
		<td class="text-center">${c.no!''}</td>
		<td class="text-center">${c.name}</td>
		<td class="text-center">${(c.priceString)!'-'}</td>
		<td class="text-center"><#if !!c.clearingReportTime> ${(c.clearingReportPrice?string('currency'))!''} <br> ${(c.clearingReportTime?string('yyyy-MM-dd'))!''} </#if>
		</td>
		<td class="text-center">${(c.clearingPrice?string('currency'))!'-'} <br> <span class="text-danger">${(c.jsRatio?string('#,###.##%'))!'-'}</span>
		</td>
		<td class="text-center">${(c.skje?string('currency'))!'-'} <br> <span class="text-danger">${(c.skjeRatio?string('#,###.##%'))!'-'}</span>
		</td>
		<td class="text-center">${(c.wsje?string('currency'))!'-'} <br> <span class="text-danger">${(c.wsjeRatio?string('#,###.##%'))!'-'}</span>
		</td>
		<td class="text-center">${(c.zcje?string('currency'))!'-'} <br> <span class="text-danger">${(c.zcjeRatio?string('#,###.##%'))!'-'}</span>
		</td>
		<td class="text-center">${(c.fkje?string('currency'))!'-'} <br> <span class="text-danger">${(c.fkjeRatio?string('#,###.##%'))!'-'}</span>
		</td>
		<td class="text-center">${(c.wfje?string('currency'))!'-'} <br> <span class="text-danger">${(c.wfjeRatio?string('#,###.##%'))!'-'}</span>
		</td>
		<td class="text-center">${(c.lr?string('currency'))!'-'} <br> <span class="text-danger">${(c.lrRatio?string('#.##%'))!'-'}</span>
		</td>
	</tr>
	</#list> </#if>
</table>
<script src="${request.contextPath}/app/js/encode-no.js"></script>
<script type="text/javascript">
	require([ 'suredyList', 'suredyDatetimepicker', 'jqueryForm' ], function(List) {
		var doSearch = function(page, pageSize) {
			var form = $('form.filter-form');

			form.ajaxSubmit({
				dataType : 'html',
				data : {
					page : page,
					pageSize : pageSize
				},
				success : function(html, textStatus, jqXHR) {
					if (!html)
						return false;

					$('div.suredy-content').html(html);
				},
				error : function(jqXHR, textStatus, errorThrown) {
					return false;
				}
			});
		};

		List('table.my-contract', {
			header : false,
			paginate : function(page, pageSize, key) {
				doSearch(page, pageSize);
			}
		});

		$('form.filter-form .btn.filter-search').on('click', function() {
			doSearch(1, $('table.table-bid-list').data('page-size'));
		});

		$('form.filter-form .btn.filter-reset').on('click', function() {
			$('form.filter-form input').val('');
			$('form.filter-form option:first-child').prop('selected', true);
		});
	});
</script>
